package com.lock.demo.redis.test;

/**
 * @ProjectName: lock_demo
 * @Package: com.lock.demo.mysql.test
 * @Author: huat
 * @Date: 2021/5/4 15:49
 * @Version: 1.0
 */
public class Stock {

    private static int num=1;
    public boolean reduceStock(){
        if(num>0){
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            num--;
            return true;
        }else{
            return false;
        }
    }
}
